package com.cloud.api.login.controller;

import com.cloud.api.common.log.CloudApiAnnotation;
import com.cloud.api.common.result.R;
import com.cloud.api.login.service.ApiWxService;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/login/test")
public class LoignController {

    @Autowired
    private ApiWxService apiWxService;


    @CloudApiAnnotation(operMoudle = "登录接口", operMethod = "login", operDes = "测试")
    @GetMapping("/login")
    public R login(@RequestParam("id") String id) {
        return R.ok(id);

    }


    /**
     * 微信小程序code换取Token
     * QQ小程序code换取Token
     *
     * @param code
     * @param type
     * @return
     */
    @GetMapping("/loginCode")
    public R wxlogin(@RequestParam("code") String code, @RequestParam("type") String type) {
        return apiWxService.queryApiWx(code, type);

    }
}
